package merlin.utils;

import java.sql.*;
import java.io.*;
import java.util.HashMap;

import net.sf.jasperreports.engine.JasperRunManager;


/**
 * Class to run and generate PDF reports using Jasper Reports.
 */
public class JasperReportsGenerator{

	public static void generatePrinterLabels(OutputStream out)throws IOException{
		try{
			Class.forName("com.frontbase.jdbc.FBJDriver");
			Connection con = DriverManager.getConnection("jdbc:FrontBase://localhost/MERLINRESEARCHER","_system","PASSWORD");

			InputStream reportStream = JasperReportsGenerator.class.getClassLoader().getResourceAsStream("reports/labels.jasper");

			JasperRunManager.runReportToPdfStream(reportStream, out, new HashMap(), con);
		}catch(Exception e){
			e.printStackTrace();
			throw new RuntimeException(e);
		}
	}

}